package com.quan.base.common.base.service.support ;

import java.util.List;

import com.github.pagehelper.PageInfo;
import com.quan.base.common.exception.BizException;
import com.quan.base.common.utils.Paginator;

/**
 * 基础 Service 接口<br>
 * Service接口可以继承该基础接口，该接口定义了基础的CRUD<br>
 * @author yhaoquan
 *
 * @param <T>
 * @param <PK>
 */
public interface IService<T, PK> {

	T insert(T entity) throws BizException ;
	
	T insertSelective(T entity) throws BizException ;
	
	List<T> insertBatch(List<T> entityList) throws BizException ;
	
	int delete(PK id) throws BizException ;
	
	int deleteSelective(T entity) throws BizException ;
	
	int deleteByIds(List<PK> idList) throws BizException ;
	
	int deleteByIds(String ids) throws BizException ;
	
	T update(T entity) throws BizException ;
	
	T updateSelective(T entity) throws BizException ;
	
	T update(T entity, T whereEntity) throws BizException ;
	
	T updateSelective(T entity, T whereEntity) throws BizException ;
	
	List<T> updateBatchById(List<T> entityList) throws BizException ;
	
	T selectById(PK id) throws BizException ;
	
	T selectOne(T entity) throws BizException ;
	
	int selectCount(T entity) throws BizException ;
	
	List<T> selectByIds(List<PK> idList) throws BizException ;
	
	List<T> selectByIds(String ids) throws BizException ;
	
	List<T> selectAll() throws BizException ;
	
	List<T> selectList(T entity) throws BizException ;
	
	List<T> selectList(T entity, String orderBy) throws BizException ;
	
	PageInfo<T> selectPage(Paginator paginator) throws BizException ;
	
	PageInfo<T> selectPage(Paginator paginator, T entity) throws BizException ;
	
	T checkValue(String field, Object value) throws BizException ;
	
}
